package com.stronger.pettern.Single;

/**
 * 双重校验锁写法
 */
public class DoubleLockSingleton {
    private volatile static DoubleLockSingleton singleton;
    private DoubleLockSingleton(){}
    public static DoubleLockSingleton getSingleton(){
        if(singleton==null){
            synchronized (DoubleLockSingleton.class){
                if(singleton==null){
                    singleton=new DoubleLockSingleton();
                }
            }
        }
        return singleton;
    }
}
